package com.dundun.pattern.facade;

import java.io.FileWriter;
import java.util.Properties;

public class PageMaker {
    private PageMaker() {}

    public static void makeWelcomePage(String mailaddr, String fileName) {
        try {
            Properties prop = Database.getProperties("maildata");
            String username = prop.getProperty(mailaddr);
            HtmlWriter writer = new HtmlWriter(new FileWriter("target/" + fileName));
            writer.title("welcome to " + username + "'s page");
            writer.paragraph("欢迎来到" + username + "的主页");
            writer.paragraph("等着你的邮件哦");
            writer.mailto(mailaddr, username);
            writer.close();
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
}
